package com.whately.core.base.utils;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

public class HttpRequestUtil {

    /**
     * 获取请求信息： requestParam
     *
     * @param httpServletRequest
     * @return
     */
    public static Map<String, String> getRequestInfo(HttpServletRequest httpServletRequest) {
        Map<String, String> map = new HashMap<>();
        Enumeration paramNames = httpServletRequest.getParameterNames();
        while (paramNames.hasMoreElements()) {
            String key = (String) paramNames.nextElement();
            String value = httpServletRequest.getParameter(key);
            map.put(key, value);
        }
        return map;
    }
}
